import java.util.Arrays;
import java.util.Scanner;

public class Test {
    public static void main(String[] args) {
        int[] arr={1,2,3,4,5,6};
        System.out.println("排序前："+Arrays.toString(arr));
        sort(arr);
        System.out.println("排序后："+Arrays.toString(arr));
    }

    public static void sort(int[] arr){
        int j=arr.length-1;
        int i=0;
        while(i<=j){
            if(arr[i]%2==0) {
                int tmp = arr[i];
                arr[i] = arr[j];
                arr[j] = tmp;
                j--;
                i--;
            }
            i++;
        }
    }
    public static void main2(String[] args) {
        int[] arr={1,2,3,4,5};
        System.out.println("变换前："+ Arrays.toString(arr));
        transform(arr);
        System.out.println("变换后："+ Arrays.toString(arr));
    }

    public static void transform(int[] arr){
        for(int i=0;i<arr.length;i++){
            arr[i]*=2;
        }
        return;
    }
    public static void main1(String[] args) {
        Scanner scanner=new Scanner(System.in);
        int n=scanner.nextInt();
        huaoit(n,'A','B','C');
    }
    public static void move(char pos1,char pos2){
        System.out.print(pos1+"->"+pos2+" ");
    }

    public static void huaoit(int n,char pos1,char pos2,char pos3){
        if(n==1){
            move(pos1,pos3);
        }else{
            huaoit(n-1,pos1,pos3,pos2);
            move(pos1,pos3);
            huaoit(n-1,pos2,pos1,pos3);
        }
    }
}
